package com.tanhua.model.dto;

import com.tanhua.model.domain.UserInfo;
import com.tanhua.model.mongo.RecommendUser;
import com.tanhua.model.vo.UserInfoVo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserInfoDto {
    private Long id; //用户id
    private String nickname; //昵称
    private String avatar; //用户头像
    private String birthday; //生日
    private String gender; //性别
    private Integer age; //年龄
    private String city; //城市
    private String income; //收入
    private String education; //学历
    private String profession; //行业
    private Integer marriage; //婚姻状态
    private Integer matchRate; //匹配度
    private Boolean alreadyLove = false;

    /**
     * 在vo对象中，补充一个工具方法，封装转化过程
     */
    public static UserInfoDto init(UserInfo userInfo, RecommendUser recommendUser) {
        UserInfoDto userInfoVo = new UserInfoDto();
        BeanUtils.copyProperties(userInfo,userInfoVo);
        userInfoVo.setMatchRate(recommendUser.getScore().intValue());
        return userInfoVo;
    }
}
